function getRealTerm(){
	var date = new Date();
	var year = date.getFullYear();
	var mouth = date.getMonth()+1;
	var realterm;
	if(mouth >= 9 || mouth <= 2) {
		if(mouth >=9){
			realterm = year+"01";
		}else{
			realterm = year-1+"01";
		}
	}else {
		realterm = year-1+"02";
	}
	return realterm;
};

function getUrl()
{
	//var pageContext = document.getElementById("PageContext").value;
	
	var pathName = document.location.pathname;
    var index = pathName.substr(1).indexOf("/");
    var result = pathName.substr(0,index+1);
    return result;
}


function courseFindByTid(){
	var result = getUrl(); 
    window.parent.body.location.href=result+"/course/findByTid";
}

function reportFindBySid(){
	var result = getUrl(); 
    window.parent.body.location.href=result+"/report/findBySid";
}

//function courseFindByTerm(){
//	var result = getUrl(); 
//    window.parent.body.location.href=result+"/course/findByTerm?term="+getRealTerm();
//}

//var xmlhttp;
//function loadXMLDoc(url,cfunc)
//{
//
//	if (window.XMLHttpRequest)
//	  {// IE7+, Firefox, Chrome, Opera, Safari 代码
//	  xmlhttp=new XMLHttpRequest();
//	  }
//	else
//	  {// IE6, IE5 代码
//	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
//	  }
//	xmlhttp.onreadystatechange=cfunc;
//	xmlhttp.open("GET",url,true);
//	xmlhttp.send();
//}

function syllabusFindBySid()
{
//	var url = getUrl()+"/syllabus/findBySid?term="+getRealTerm();
//	loadXMLDoc(url, function()
//	{
//		if(xmlhttp.readyState==4 && xmlhttp.status==200)
//		{
//			window.parent.body.location.href=getUrl()+"/jsps/syllabus/list.jsp";
//		}
//	});
	var result = getUrl(); 
    window.parent.body.location.href=result+"/syllabus/findBySid?term="+getRealTerm();
}

//function syllabusFindBySid2()
//{
//	var result = getUrl(); 
//    window.parent.body.location.href=result+"/syllabus/findBySid2?term="+getRealTerm();
//}